﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;
using System.Globalization;
using Nivdal.AuxCode;
using System.Text;

namespace Nivdal
{
    public partial class AllTournaments : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Title = Resources.Resource.Default_PageTitle + ", " + Resources.Resource.AllTournaments_PageTitle;
            OnlineUser ou = (OnlineUser)Session["User"];

            if (!IsPostBack)
            {
                CompletedTournamentsSqlDataSource.SelectParameters.Add("Language", ou.Language);
                OngoingTournamentsDataSource.SelectParameters.Add("Language", ou.Language);
                SignupTournamentsDataSource.SelectParameters.Add("Language", ou.Language);

                if (Request.QueryString["Message"] != null)
                    MessageLabel.Text = Request.QueryString["Message"];
                else
                    MessagePanel.Visible = false;

                CreateTournamentLink.Visible = ou.IsPremium;

            }
        }

        protected override void InitializeCulture()
        {
            OnlineUser ou = (OnlineUser)Session["User"];
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(ou.UICulture);
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(ou.Culture);
        }
    }
}